﻿package mortal.game.view.achievement
{
    import Framework.Util.*;
    import Message.Game.*;
    import extend.language.*;
    import mortal.common.error.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;

    public class AchievementProx extends Proxy
    {

        public function AchievementProx()
        {
            return;
        }// end function

        public function getAchievementOverview() : void
        {
            rmi.iAchievementPrx.getAchievementOverview_async(new AMI_IAchievement_getAchievementOverview(this.ongetOverViewDataSuccess, this.onFail));
            return;
        }// end function

        private function ongetOverViewDataSuccess(param1:AMI_IAchievement_getAchievementOverview, param2:Array) : void
        {
            Cache.instance.achievent.initOverViewData(param2);
            NetDispatcher.dispatchCmd(ServerCommand.AchievementCategoryDataGot, null);
            return;
        }// end function

        public function getUpcomingAchievement() : void
        {
            rmi.iAchievementPrx.getUpcomingAchievement_async(new AMI_IAchievement_getUpcomingAchievement(this.getUpComingDataSuccess, this.onFail));
            return;
        }// end function

        private function getUpComingDataSuccess(param1:AMI_IAchievement_getUpcomingAchievement, param2:Array) : void
        {
            Cache.instance.achievent.upComingArr = param2;
            NetDispatcher.dispatchCmd(ServerCommand.AchievementUpComingDataGot, null);
            return;
        }// end function

        public function getAchievementCategroy(param1:int) : void
        {
            rmi.iAchievementPrx.getAchievementCategroy_async(new AMI_IAchievement_getAchievementCategroy(this.getAchievementCategroySuccess, this.onFail), param1);
            return;
        }// end function

        private function getAchievementCategroySuccess(param1:AMI_IAchievement_getAchievementCategroy, param2:Array) : void
        {
            Cache.instance.achievent.initTypeData(param2);
            NetDispatcher.dispatchCmd(ServerCommand.AchievementTypeDataGot, null);
            return;
        }// end function

        public function getCategoryAchievementReward(param1:int) : void
        {
            rmi.iAchievementPrx.getCategoryAchievementReward_async(new AMI_IAchievement_getCategoryAchievementReward(this.getCategoryAchievementRewardSuccess, this.onFail), param1);
            return;
        }// end function

        private function getCategoryAchievementRewardSuccess(param1:AMI_IAchievement_getCategoryAchievementReward) : void
        {
            MsgManager.showRollTipsMsg(Language.getString(70814));
            return;
        }// end function

        public function getAchievementReward(param1:int) : void
        {
            rmi.iAchievementPrx.getAchievementReward_async(new AMI_IAchievement_getAchievementReward(this.getAchievementRewardSuccess, this.onFail), param1);
            return;
        }// end function

        private function getAchievementRewardSuccess(param1:AMI_IAchievement_getAchievementReward) : void
        {
            MsgManager.showRollTipsMsg("" + Language.getString(70815));
            return;
        }// end function

        private function onFail(param1:Exception) : void
        {
            MsgManager.showRollTipsMsg(ErrorCode.getErrorStringByCode(param1.code));
            Cache.instance.achievent.getCatoryType = -1;
            Cache.instance.achievent.getTypeType = -1;
            return;
        }// end function

    }
}
